home *** CD-ROM | disk | FTP | other *** search
- # Program: xf
- # Description: handle bargraph widgets
- #
- # $Header: Bargraph[2.3] Wed Mar 10 11:57:18 1993 garfield@garfield frozen $
-
- global xfDefaultConf
- set xfDefaultConf(bargraph) 4
-
- ##########
- # Procedure: XFAdd.Bargraph
- # Description: add a bargraph
- # Arguments: xfW - the widget
- # xfName - a optional name
- # xfType - add or config
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFAdd.Bargraph {xfW xfName xfType} {
- global xfStatus
-
- XFEditSetStatus "Inserting Bargraph..."
- set xfName [XFMiscGetUniqueName $xfName bargraph]
- if {"$xfStatus(path)" == "."} {
- if {"$xfType" == "add"} {
- if {[catch "bargraph .$xfName" xfResult]} {
- XFProcError "$xfResult"
- XFEditSetStatus "Inserting Bargraph...aborted"
- return
- }
- } {
- if {[catch "bargraph .$xfName" xfResult]} {
- XFProcError "$xfResult"
- XFEditSetStatus "Inserting Bargraph...aborted"
- return
- }
- }
-
- XFMiscPositionWidget .$xfName
- XFMiscBindWidgetTree .$xfName
- } {
- if {"$xfType" == "add"} {
- if {[catch "bargraph $xfStatus(path).$xfName" xfResult]} {
- XFProcError "$xfResult"
- XFEditSetStatus "Inserting Bargraph...aborted"
- return
- }
- } {
- if {[catch "bargraph $xfStatus(path).$xfName" xfResult]} {
- XFProcError "$xfResult"
- XFEditSetStatus "Inserting Bargraph...aborted"
- return
- }
- }
-
- XFMiscPositionWidget $xfStatus(path).$xfName
- XFMiscBindWidgetTree $xfStatus(path).$xfName
- }
-
- incr xfStatus(elementCounter)
- XFEditSetPath $xfStatus(path)
- XFEditSetStatus "Inserting Bargraph...done"
- }
-
- ##########
- # Procedure: XFConfig.Bargraph4
- # Description: configure a bargraph
- # Arguments: xfW - the widget
- # xfType - config type (add or config)
- # xfClass - the class we configure
- # xfLeader - the leading window
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFConfig.Bargraph4 {xfW xfType xfClass {xfLeader ""}} {
- global xfStatus
-
- if {"$xfType" == "add"} {
- set xfName bargraph$xfStatus(elementCounter)
- } {
- set xfName [XFMiscPathName $xfW]
- }
- XFEditSetStatus "Calling parameter setting for Bargraph..."
-
- # build widget structure
- XFTmpltToplevel .xf${xfClass}Config4 400x600 \
- "Bargraph parameters:[XFMiscPathTail $xfW]" $xfLeader
-
- XFElementInit $xfW .xf${xfClass}Config4 $xfType $xfClass \
- XFBargraphSetBargraph4 parameters $xfName 4
- XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass bg \
- background Background "Background" XFBargraphSetBargraph4
- XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass barcolor \
- barcolor Barcolor "Bar color" XFBargraphSetBargraph4
- XFElementScale $xfW .xf${xfClass}Config4 $xfType $xfClass base \
- base Base "Base" "" 1000 \
- XFBargraphSetBargraph4
- XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass interval \
- interval Interval "Interval" XFBargraphSetBargraph4
- XFElementOrient $xfW .xf${xfClass}Config4 $xfType $xfClass \
- XFBargraphSetBargraph4
- XFElementSize $xfW .xf${xfClass}Config4 $xfType $xfClass \
- XFBargraphSetBargraph4
- XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass title \
- title Title "Text" XFBargraphSetBargraph4
- XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass textcolor \
- textcolor Foreground "Text color" XFBargraphSetBargraph4
- XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass tickcolor \
- tickcolor Foreground "Tick color" XFBargraphSetBargraph4
- XFElementScale $xfW .xf${xfClass}Config4 $xfType $xfClass tickinterval \
- tickinterval Tickinterval "Tickinterval" "pixels" 100 \
- XFBargraphSetBargraph4
- XFElementScaleDouble $xfW .xf${xfClass}Config4 $xfType \
- $xfClass value "Value" "Min" "Max" 1000 1000
- XFElementCommand $xfW .xf${xfClass}Config4 $xfType
-
- .xf${xfClass}Config4.params1.params2.value.value1.value1 set \
- [lindex [$xfW config -min] 4]
- .xf${xfClass}Config4.params1.params2.value.value2.value2 set \
- [lindex [$xfW config -max] 4]
-
- XFMiscSetResource \
- .xf${xfClass}Config4.params1.params2.value.value1.value1 \
- command "XFBargraphSetBargraph4 $xfW 0 $xfClass"
- XFMiscSetResource \
- .xf${xfClass}Config4.params1.params2.value.value2.value2 \
- command "XFBargraphSetBargraph4 $xfW 0 $xfClass"
-
- # save current parameter
- XFElementSave $xfW $xfClass {background barcolor base interval orient title textcolor tickcolor tickinterval max min width height command}
-
- # packing
- pack append .xf${xfClass}Config4.params1 \
- .xf${xfClass}Config4.params1.params2 {left fill expand}
- pack append .xf${xfClass}Config4 \
- .xf${xfClass}Config4.pathname {top fill frame center} \
- .xf${xfClass}Config4.leave {bottom fill} \
- .xf${xfClass}Config4.additional {bottom fill} \
- .xf${xfClass}Config4.params1 {top fill expand}
-
- XFBindFormConnect .xf${xfClass}Config4.params1.params2 \
- "XFBargraphSetBargraph4 $xfW 0 $xfClass"
-
- XFEditSetStatus "Calling parameter setting for Bargraph...done"
- }
-
- ##########
- # Procedure: XFSaveSpecial.Bargraph
- # Description: save bargraph
- # Arguments: xfW - the widget
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFSaveSpecial.Bargraph {xfW} {
-
- return "\n $xfW set [$xfW get]"
- }
-
- ##########
- # Procedure: XFBargraphSetBargraph4
- # Description: set bargraph parameters
- # Arguments: xfW - the widget
- # xfType - the type of setting (1 = set always, 0 = set
- # only if permanent apply is on)
- # xfClass - the class we configure
- # xfParam1 - ignored parameter
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFBargraphSetBargraph4 {xfW xfType xfClass {xfParam1 ""}} {
- global xfConf
- global xfMisc
-
- if {$xfType == 0 && !$xfConf(applyParameters)} {
- return
- }
- if {"[info commands $xfW]" == ""} {
- return
- }
- XFMiscSetSymbolicName $xfW \
- [.xf${xfClass}Config4.params1.params2.symname.symname get]
-
- XFMiscSetResource $xfW background \
- [.xf${xfClass}Config4.params1.params2.bg.bg get]
- if {"[.xf${xfClass}Config4.params1.params2.barcolor.barcolor get]" != ""} {
- XFMiscSetResource $xfW barcolor \
- [.xf${xfClass}Config4.params1.params2.barcolor.barcolor get]
- }
- XFMiscSetResource $xfW base \
- [.xf${xfClass}Config4.params1.params2.base.base get]
- XFMiscSetResource $xfW command \
- [XFMiscGetText .xf${xfClass}Config4.params1.params2.command.command.command]
- if {"[.xf${xfClass}Config4.params1.params2.interval.interval get]" != ""} {
- XFMiscSetResource $xfW interval \
- [.xf${xfClass}Config4.params1.params2.interval.interval get]
- } {
- XFMiscSetResource $xfW interval 0
- }
- XFMiscSetResource $xfW max \
- [.xf${xfClass}Config4.params1.params2.value.value2.value2 get]
- XFMiscSetResource $xfW min \
- [.xf${xfClass}Config4.params1.params2.value.value1.value1 get]
- XFMiscSetResource $xfW orient $xfMisc(orient)
- XFMiscSetResource $xfW textcolor \
- [.xf${xfClass}Config4.params1.params2.textcolor.textcolor get]
- XFMiscSetResource $xfW tickcolor \
- [.xf${xfClass}Config4.params1.params2.tickcolor.tickcolor get]
- XFMiscSetResource $xfW tickinterval \
- [.xf${xfClass}Config4.params1.params2.tickinterval.tickinterval get]
- XFMiscSetResource $xfW title \
- [.xf${xfClass}Config4.params1.params2.title.title get]
- XFMiscSetResource $xfW height \
- [.xf${xfClass}Config4.params1.params2.size.size2.size2 get]
- XFMiscSetResource $xfW width \
- [.xf${xfClass}Config4.params1.params2.size.size1.size1 get]
- }
-
- # eof
-
-